<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Template {
	var $ci;
	var $data = array();
	
	function __construct(){
		$this->ci =& get_instance();
		
	}
	
	function load_template($template, $data){
		$this->set_default($data);
		$this->data = array_merge($this->data, $data);
		$this->ci->load->view('templates/'.$template, $this->data);
	}

	function set_default($data){
		$this->data['head'] = $this->ci->load->view('templates/html/vHead', $data, TRUE);
		$this->data['header'] = $this->ci->load->view('templates/html/vHeader', $data, TRUE);
		$this->data['footer'] = $this->ci->load->view('templates/html/vFooter', $data, TRUE);
	}
	
	function set_header($html, $data){
		$this->data['header'] = $this->ci->load->view($html, $data, TRUE);
	}
	
	function set_footer($html, $data){
		$this->data['footer'] = $this->ci->load->view($html, $data, TRUE);
	}
	
	function set_body($html, $data, $show_menu = TRUE){
		if($show_menu){
			$menu = $this->ci->load->view('page-blocks/page-module/vMenu', '', TRUE);
			if($html != NULL)
				$this->data['body'] = $menu.$this->ci->load->view($html, $data, TRUE);
			else 
				$this->data['body'] = $menu;
		}
		else {
			$this->data['body'] = $this->ci->load->view($html, $data, TRUE);
		}

	}
	

	
}
  
  
   
?>